/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#define OMEN_SOURCE 1

#include <OmenEventHandler.h>

using namespace Omen;

OMEN_API EventHandler::~EventHandler()
{
    Handlers::iterator it = _handlers.begin();
    while( it != _handlers.end())
    {
        delete it->second;
        ++it;
    }
    _handlers.clear();
}

void EventHandler::handleEvent(const Omen::Event* event)
{
    Handlers::iterator it = _handlers.find(TypeInfo(typeid(*event)));
    if( it != _handlers.end())
    {
        it->second->exec(event);
    }
}